package com.mx.restful.beans;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Author: mengxiang.
 * @Date: 2020/6/22.
 * @Time: 11:37 上午.
 * @Description:
 */
public enum HttpMethod {

    /**
     * Request
     */
    REQUEST,

    /**
     * GET
     */
    GET,

    /**
     * POST
     */
    POST,

    /**
     * PUT
     */
    PUT,

    /**
     * DELETE
     */
    DELETE,

    /**
     * TRACE
     */
    TRACE,

    /**
     * OPTIONS
     */
    OPTIONS,

    /**
     * HEAD
     */
    HEAD,

    /**
     * PATCH
     * @return
     */
    PATCH;

    @NotNull
    public static HttpMethod[] getValues() {
        return Arrays.stream(HttpMethod.values()).filter(method -> !method.equals(HttpMethod.REQUEST)).toArray(HttpMethod[]::new);
    }

    public static List<String> valueList() {
        List<String> valueList = new ArrayList<>();
        Arrays.stream(HttpMethod.values()).forEach(v-> valueList.add(v.name()));
        return valueList;
    }
}
